import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from "@/views/public/Login.vue"
import pwdForm from "@/views/public/pwdForm.vue"
import smsForm from "@/views/public/smsForm.vue"
import publicRoutes from './modules/public'
import homeRoutes from './modules/home'
import searchRoutes from './modules/search'
import orderRoutes from './modules/order'
import myRoutes from './modules/my'
import App from "@/App"
import NotFound from "@/views/notfound/NotFound";
import city from '@/views/city/Index.vue'
Vue.use(VueRouter)


const routes = [
  // {
  //   // path:"/",
  //   // // redirect:"/home"
  //   // component
  // },
  {
    path: "/city",
    component: city,
  },
  {
    path:"/login",
    redirect:"/login/pwd",
    component:Login,
    children: [
      // 密码登录
      {
        path: "pwd",
        component: pwdForm,
      },
      // 短信登录
      {
        path: "sms",
        component: smsForm,
      },
    ],
  },
  ...publicRoutes,
  ...homeRoutes,
  ...searchRoutes,
  ...orderRoutes,
  ...myRoutes,
  {
    path: "/",
    component: App,
  },
  {
    path: "*",
    component: NotFound,
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
